def radix_sort(array):
    n=len(str(max(array)))
    groups=[ [] for i in range(10) ]
    for i in range(n):
        for number in array:
            base=(number//(10**i))%10
            groups[base].append(number)
        j=0
        for group in groups:
            while group:
                array[j]=group.pop(0)
                j+=1

array=[121,432,564,23,1,45,788]
print(array)
radix_sort(array)
print(array)
